<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1">
    <title>吃游在线网 会吃的旅游网</title>

    <link rel="stylesheet" href="css/quote/bootstrap.css">
    <link rel="stylesheet" href="css/head.css">
    <link rel="stylesheet" href="css/footer.css">

    <script src="js/quote/jquery-3.4.1.js"></script>
    <script src="js/quote/hf.js"></script>

    <link rel="stylesheet" type="text/css" href="css/reset.css">
    <link rel="stylesheet" type="text/css" href="css/style.css">
    <script src="js/quote/jquery.js" type="text/javascript"></script>
    <script src="js/quote/jquery-migrate-1.2.1.min.js" type="text/javascript"></script>
    <link rel="stylesheet" type="text/css" href="css/commidity.css">
    <link rel="stylesheet" type="text/css" href="css/reset.css">

    <link rel="stylesheet" href="css/store.css">

    <!--  负责评论的CSS-->
    <link rel="stylesheet" type="text/css" href="css/course-comment.css"/>
    <link rel="stylesheet" type="text/css" href="css/common-less.css">




    <link rel="stylesheet" type="text/css" href="css/xcConfirm.css"/>
    <script src="js/jquery-1.9.1.js" type="text/javascript" charset="utf-8"></script>
    <script src="js/xcConfirm.js" type="text/javascript" charset="utf-8"></script>
</head>
<body>

<!--crumbs start-->
<div class="page-content container ">

    <div class="container">
        <div class="">
            <h3 style="margin: 22px 0">商家信息</h3>
        </div>
    </div>


    <section>
        <div class="wp">
            <div class="groupPurchase_detail detail">
                <div class="toppro">
                    <div class="left">
                        <div class="picbox">
                            <div class="fl slide">
                                <div class="imgslide">
                                    <ul class="imgs" id="pictu" >
                                    <!--   <li id="first"><a href="#home"><img width="440" height="445" src="images/food1.jpg"/></a>
                                        </li>
                                        <li><a href="#home"><img width="440" height="445" src="images/food1.jpg"/></a></li>
                                        <li><a href="#home"><img width="440" height="445" src="images/food1.jpg"/></a></li>-->
                                    </ul>
                                </div>
                             <!--   <div class="unslider-arrow prev"></div>
                                <div class="unslider-arrow next"></div>-->
                            </div>

                        </div>
                        <div class="des">
                            <h1 title="" id="commodityName" style="font-size: 26px; line-height: 37px; color: #555;"><!--黄焖鸡米饭--></h1>
                            <hr style="margin-top: 10px;margin-bottom: 10px"/>
                            <span class="key" id="commodityDescribe" style="font-size: 17px"><!--黄焖鸡米饭又叫香鸡煲，或叫浓汁鸡煲饭，是鲁菜名吃。是源自山东济南天桥区的传统名吃，属于鲁菜系。该特色小吃做成后色香味美，口感鲜嫩透味不粘腻，香味浓郁。--></span>
                            <div class="prize" style="margin-bottom: 0;margin-top: 10px">
                                <span class="fl">热度：<i class="key">高</i></span>
                                <span class="fr">在售：<span id="commodityIsSale" class="key">是</span></span>
                            </div>
                            <ul class="parameter" style="margin-top: 10px;margin-left: 20px">
                                <li><span class="pram "style="font-size: 17px">美食价格：</span><span id="commodityPrice"style="font-size: 17px">100</span><span style="font-size: 17px">&nbsp;元</span></li>

                                <li><span class="pram "style="font-size: 17px">美食标签：</span><span title="" id="labelList"style="font-size: 17px">微辣</span></li>
                                <li><span class="pram "style="font-size: 17px">美食评分：</span><span id="commodityScore"style="font-size: 17px">4.5</span><span style="font-size: 17px">&nbsp;分</span></li>
                                <li class="piclist"><span class="pram word4"style="font-size: 17px">美食销量：</span><span
                                        id="commodityNum"style="font-size: 17px">45000</span></li>


                            </ul>
                            <div class="btns">
<!--                                <div class="btnn colectgroupbtn" id="jsLeftBtn" href="#" onclick="addcoll(getQueryVariable())">
                                    收藏
                                </div>-->
                                <div class="buy btnn">
                                    <a style="color: white" href="#" onclick="addcoll(getQueryVariable())">收藏该美食</a>
                                </div>
                                <div class="buy btnn">
                                    <a style="color: white" href="#" onclick="addcart(getQueryVariable())">加入购物车</a>
                                </div>
                            </div>
                        </div>

                    </div>
                    <div class="right" style="height: 415px">
                        <div class="head" style="height: 95px" >
                            <h1>商店信息</h1>
                            <p id="storeDescribe">百年老店，还差九十九年</p>
                        </div>
                        <div class="pic" style="margin-top: 10px;margin-bottom: 10px">
                            <!--<a href="/company/14/">
                                <img id="store_picture" width="150" height="80" src="images/kfc.png"/>
                            </a>-->
                        </div>
                        <a href="/company/14/">
                            <h2 class="center" title="" id="storeName">肯德基</h2>
                        </a>
                        <div class="btnn  notlogin  " data-favid="14" id="jsRightBtn" onclick="addshopcoll()" style="margin-top: 10px;margin-bottom: 10px">
                            关注该商家
                        </div>
                        <div class="clear">
                            <ul>
                                <li>
                                    店主:<span id="userId">  </span>
                                </li>
                                <li>

                                    营业时间： 周一至周日 <span id="time"> 07:00-21:30</span>
                                </li>
                                <li>商店位置：&nbsp;&nbsp; <span id="storeLocation">北京市</span></li>
                            </ul>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </section>
    <section>
        <div class="wp">
            <div class="list groupPurchase_detail_pro">
                <div class="left layout">
                    <div class="head">
                        <ul class="tab_header">
                            <li class="active">商品评论</li>
                        </ul>
                    </div>
                    <!--这个div为商品评论-->
                    <div class="tab_cont tab_cont1">
                        <div class="course-info-main clearfix w has-progress">
                            <div class="info-bar clearfix">
                                <div class="content-wrap clearfix">
                                    <div class="content" style="width: 720px">
                                        <!--发布评论-->
                                        <div class="issques clearfix ">
                                            <div class="wgt-ipt-wrap pub-editor-wrap " id="js-pl-input-fake">
                                                <textarea id="js-pl-textarea" class=""
                                                          placeholder="扯淡、吐槽、表扬、鼓励……想说啥就说啥！"
                                                          style="width: 680px"></textarea>
                                            </div>
                                            <input type="button" onclick="addComment(getQueryVariable())" id="js-pl-submit" class="pub-btn" value="发表评论">
                                        </div>


                                        <!-- gbl 评论部分内容，一个li中是一个主评论 -->
                                        <div id="course_note ">
                                            <ul class="mod-post" id="comment-list">
                                                <li class="post-row">
                                                    <div class="media">
                                                        <span><img src='images/user1.png' width='40' height='40'/></span>
                                                    </div>
                                                    <div class="bd">
                                                        <div class="tit">
                                                            <span>bobby</span>
                                                        </div>
                                                        <p class="cnt">软嫩鲜香的口感、鲜香倍增、汤汁浓郁回甘、浓香四溢！！！</p>
                                                        <div class="footer">
                                                            <span title="创建时间" class="">时间：2019年09月09日 22:14</span>
                                                            <div class="reply"><button class="addreply">回复</button></div>
                                                            <div class="replyText" hidden>
                                                                <input class="inputReply" placeholder="随便写一点">
                                                                <div class="issue"><button onclick="getReplyInfo()">发布</button></div>
                                                            </div>
                                                            <!-- twoReply下面的内容是二级评论 -->
                                                            <div class="towReply">
                                                                <!-- 二级评论模型 -->
                                                                <ul class="mod-post2">
                                                                    <li class="post-row2">
                                                                        <div class="media">
                                                                            <span><img src='images/user1.png' width='30' height='30'/></span>
                                                                        </div>
                                                                        <div class="bd2">
                                                                            <div class="tit">
                                                                                <span>bobby</span>
                                                                            </div>
                                                                            <p class="cnt">这辈子唯一拿得起放不下的是筷子。</p>
                                                                            <div class="footer">
                                                                                <span title="创建时间" class="">时间：2019年09月09日 22:14</span>
                                                                                <div class="reply">
                                                                                    <button class="addreply">回复</button>
                                                                                </div>
                                                                                <div class="replyText" hidden>
                                                                                    <input class="inputReply" placeholder="随便写一点">
                                                                                    <div class="issue"><button onclick="getReplyInfo()">发布</button></div>
                                                                                </div>
                                                                            </div>
                                                                        </div>
                                                                    </li>
                                                                </ul>
                                                            </div>
                                                        </div>
                                                    </div>
                                                </li>

                                                <li class="post-row">
                                                    <div class="media">
                                                        <span><img src='images/user1.png' width='40' height='40'/></span>
                                                    </div>
                                                    <div class="bd">
                                                        <div class="tit">
                                                            <span>bobby</span>
                                                        </div>
                                                        <p class="cnt">竹外桃花三两枝，春江水暖鸭先知。 蒌蒿满地芦芽短，正是河豚欲上时。</p>
                                                        <div class="footer ">
                                                            <span title="创建时间" class="">时间：2019年09月09日 22:14</span>
                                                        </div>
                                                    </div>
                                                </li>
                                                <li class="post-row">
                                                    <div class="media">
                                                        <span><img src='images/user1.png' width='40' height='40'/></span>
                                                    </div>
                                                    <div class="bd">
                                                        <div class="tit">
                                                            <span>bobby</span>
                                                        </div>
                                                        <p class="cnt">这辈子唯一拿得起放不下的是筷子。</p>
                                                        <div class="footer ">
                                                            <span title="创建时间" class="">时间：2019年09月09日 22:14</span>
                                                        </div>
                                                    </div>
                                                </li>

                                            </ul>
                                        </div>

                                    </div>

                                </div>


                            </div>

                        </div>

                <!--        <div class="pageturn">
                            <ul class="pagelist">

                                <li class="active"><a href="?page=1" style="text-decoration: none;">1</a></li>

                                <li><a href="?page=2" class="page" style="text-decoration: none;">2</a></li>
                                、
                                <li class="long"><a href="?page=2" style="text-decoration: none;">下一页</a></li>

                            </ul>
                        </div>-->

                    </div>

                </div>
                <div class="right layout">
                    <div class="head">相关美食推荐</div>
                    <div class="group_recommend">

                        <dl>
                            <dt>
                                <a target="_blank" href="commodity.html?commodityId=hs00020005">
                                    <img width="240" height="220" class="scrollLoading" src="http://pz52rywvb.bkt.clouddn.com/b21c8701a18b87d6934fc91e0d0828381f30fda6.png"/>
                                </a>
                            </dt>
                            <dd>
                                <a target="_blank" href=""><h2> 一品锅</h2></a>
                                <span class="fl">热度：<i class="key">高</i></span>
                            </dd>
                        </dl>


                    </div>
                </div>
            </div>
        </div>
    </section>


</div>

<!--这三个负责轮播图-->
<!--<script src="js/unslider.js" type="text/javascript"></script>
<script src="js/login.js"  type="text/javascript"></script>-->

<!--根据url获取商品id-->
<script>
    function getQueryVariable() {
        let query = window.location.search.substring(1);
        let pair = query.split("=");
        return pair[1];
    }
</script>

<script>

    var storeId;
    var a;
    var commodityId = getQueryVariable();
    $.ajax({
        url: "/commodity/findCommById",
        data: {"commodityId": commodityId},
        success: function (data) {
            console.log(data)
            $("#commodityName").html(data.commodityName)
            $("#commodityDescribe").html(data.commodityDescribe)

            if (data.commodityIsSale == 1) {
                $("#commodityIsSale").html("是")
            } else {
                $("#commodityIsSale").html("否")
            }

            storeId = data.storeId;

            $("#commodityPrice").html(data.commodityPrice)
            $("#commodityScore").html(data.commodityScore)
            $("#commodityNum").html(data.commodityNum)


            var html = '';
            for (var i = 0; i < data.labelList.length; i++) {
                if (i + 1 == data.labelList.length) {
                    html += data.labelList[i].labelName;
                }else {
                    html += data.labelList[i].labelName+'，';
                }
            }
            $("#labelList").html(html)

            $("#storeLocation").html(data.store.storeLocation)
            $("#storeName").html(`<a href="/storeInfo.html?storeId=`+storeId+`">`+data.store.storeName+`</a>`)
            $("#storeDescribe").html(data.store.storeDescribe)
            $("#userId").html(data.store.userId)

            $(".pic").html(`<a href="/storeInfo.html?storeId=`+storeId+`"><img id="store_picture" width="150" height="80" src="`+data.store.pictureList[0].picture+`"/></a>`)
            /*$("#store_picture").attr("src", data.store.pictureList[0].picture)*/

            var firstTime = data.store.storeBusinessHours
            var i1 = firstTime.indexOf("T");
            firstTime = firstTime.substr(i1)
            var i2 = firstTime.lastIndexOf(":");
            firstTime = firstTime.substring(1, i2)
            var lastTime = data.store.storeProofingHours
            var i3 = lastTime.indexOf("T")
            lastTime = lastTime.substr(i3)
            var i4 = lastTime.lastIndexOf(":");
            lastTime = lastTime.substring(1, i4)
            var time = firstTime + "-" + lastTime
            $("#time").html(time)
            var html="";

            html += ' <li><a href="#home"><img  style="width: 440px;height: 350px ;overflow: hidden; margin: 0 auto;" src="' +  data.pictureList[0].picture + '"class="img-rounded" /></a></li>'






         $("#pictu").html(html)

        }

    })


</script>
<script>
    //添加到购物车
    function addcart(commodityId) {
        var ok = window.confirm("确定要添加该商品到购物车吗")
        if (ok) {
            $.get("user/finduser", {}, function (data) {
                if (data.length > 0) {
                    var user = data;
                    $.ajax({
                        url: "/collection/addtoshopcart",
                        dataType: "json",
                        data: "userId=" + user + "&commodityId=" + commodityId,
                        success: function (data) {
                            alert(data.message)

                        }
                    })
                }else{
                    location.href="error/403.html"
                }
            });
        }
    }

    //添加到收藏
    function addcoll(commodityId) {
        var ok = window.confirm("确定要添加该商品到收藏吗")
        if (ok) {
            $.get("user/finduser", {}, function (data) {
                if (data.length > 0) {
                    var user = data;
                    $.ajax({
                        url: "/shoppingcart/addtocoll",
                        dataType: "json",
                        data: "userId=" + user + "&commodityId=" + commodityId,
                        success: function (data) {
                            alert(data.message)

                        }
                    })
                }else{
                    location.href="error/403.html"
                }
            });
        }
    }
</script>
<script>
    //添加到收藏
    function addshopcoll() {
        var ok = window.confirm("确定要收藏该商家吗")
        if (ok) {
            $.get("user/finduser", {}, function (data) {
                if (data.length > 0) {
                    var user = data;
                    $.ajax({
                        url: "/collection/addtocoll",
                        dataType: "json",
                        data: "userId=" + user + "&storeId=" + storeId,
                        success: function (data) {
                            alert(data.message)

                        }
                    })
                }else{
                    alert("请先登录")

                }
            });
        }
    }
</script>
<script src="eatwebjs/comment.js"></script>
</body>
</html>
